package juego

import org.uqbar.arena.windows.SimpleWindow
import org.uqbar.arena.windows.WindowOwner
import org.uqbar.arena.widgets.Panel
import unq.model.Juego
import org.uqbar.arena.widgets.Label
import org.uqbar.arena.widgets.Button
import org.uqbar.arena.layout.HorizontalLayout
import model.AppModel.MapamundiAppModel
import model.AppModel.ExpedientesAppModel
import model.AppModel.ReporteAppModel
import model.AppModel.ResolverMisterioAppModel
import org.uqbar.arena.layout.VerticalLayout
import org.uqbar.arena.layout.ColumnLayout

class JuegoMain extends SimpleWindow<Juego> {

	new(WindowOwner parent, Juego model) {
		super(parent, model)
		title = "¿ Donde esta Carmen Sandiego ?"
	}

	override protected addActions(Panel actionsPanel) {
		//	throw new UnsupportedOperationException("TODO: auto-generated method stub")
	}

	override protected createFormPanel(Panel mainPanel) {
		mainPanel.setLayout(new ColumnLayout(3))
		new Label(mainPanel) => [text = "   " fontSize = 13]
		new Label(mainPanel) => [text = "   " fontSize = 13]
		new Label(mainPanel) => [text = "¿Que Haremos Ahora Detective?" fontSize = 13]
		new Label(mainPanel) => [text = "   " fontSize = 13]
		new Label(mainPanel) => [text = "   " fontSize = 13]
		new Button(mainPanel) => [
			caption = "Resolver Misterio"
			val item = (Math.random() * modelObject.listaCasos.size()) as int
			onClick = [|
				new ReporteDeCrimenWindow(this, new ResolverMisterioAppModel(modelObject.listaCasos.get(item))).open
				close
				]
		]

		new Button(mainPanel) => [
			caption = "Mapamundi"
			onClick = [|new MapamundiWindows(this, new MapamundiAppModel(this.modelObject)).open]
		]

		new Button(mainPanel) => [
			caption = "Expediente"
			onClick = [|new ExpedientesWindow(this, new ExpedientesAppModel(this.modelObject)).open]
		]

	}

}
